use anyhow::{anyhow, Result};
use std::{thread, time};
use tauri_plugin_rrai_idns::devices::devices_device_login;

#[tokio::main]
async fn main() -> Result<()> {
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::DEBUG)
        .init();
    tracing::info!("RRAI 启动...");

    //
    let token = String::from("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyaWQiOiI1OTEyMDg4ZTQ4YmM0MGFjODQ2MjJiMzMwZTg0MTc1ZiIsInVuaW9uaWQiOiJvbXVSV3c4N2w1Q3ZacVhaZmFTbmVzRnVXZVBvIiwib3BlbmlkIjoib1ozY2w0eEV6cGlLWW1MMS10LTJEU0dDLTJqMCIsImV4cCI6MTY5OTkzOTcwMzQwNX0.W1idvB88IbLSgOT8Ql66DZ4Ud3TcF07HEGLNJmFUb1I");

    let peer_id = String::from("5912088e48bc40ac84622b330e84175f111");

    let res = devices_device_login(&token).await;

    match res {
        Ok(_) => {}
        Err(err) => {
            println!("{:#?}", err);
        }
    }
    //sleep
    let ten_millis = time::Duration::from_millis(100000);
    let now = time::Instant::now();

    thread::sleep(ten_millis);
    Ok(())
}
